-
Notifications
You must be signed in to change notification settings - Fork 2.6k
feat: Tool timeout + recover from hanging #5515
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
✅ No security or compliance issues detected. Reviewed everything up to 20a27f7. Security Overview
Detected Code ChangesThe diff is too large to display a summary of code changes. Reply to this PR with |
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @liwilliam2021, I left a couple of suggestions that are worth taking a look at.
Let me know what you think!
Co-authored-by: Daniel <[email protected]>
daniel-lxs
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
mrubens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In practice I still haven’t seen any tool hang other than execute_command and trying to call a MCP that doesn’t exist. I wonder if we should start with just the telemetry to get a sense of whether it’s worth it to add the rest of this functionality.
Hmm yeah that's not a bad idea-- I originally overengineered this as a starting point to build off better error handling for roomotes (AI fallbacks, maybe some timeouts from terminal snapshots) that I never got around to fully. I recall there were also some hangs w/ file reads if the context was messed up. If we think the current command execution fix is sufficient I'm happy to save ourselves all some time and drop this project entirely? I also don't want to overcrowd the repo with code we don't need. Another thought it we want to keep building on this: I have another branch that has code to set custom timeout lengths for different tool executions. What if we took that and just hid the timeouts for every tool that's not "execute_command". This would in effect make this PR a settings option for the existing Roomotes command timeout functionality. |
|
Closing for now, feel free to reopen it if needed |
Added an option in auto-approve settings to automatically timeout long-running tool operations and suggest fallback options. The timeout threshold is 1 minute and can be configured. Suggested fallback options are generated by the model & are presented as a follow-up question.
This is helpful in preventing hanging.
The timeout option will remain hidden in settings until a few more PRs are merged, upon which it will be moved to the autoapprove menu.
Here is a feature loom: https://www.loom.com/share/882d05d3ae104dbb8b664ef64c0418ca
Here is the architecture diagram:

The TimeoutManager manages timeout operations generated by the ToolExecutionWrapper. The TimeoutFallbackHandler creates user-facing timeout responses by making a call to the AI generator. We have static suggestions as a fallback. We also added a set of time out tests.
In separate PRs, we will enable
Important
Introduces a configurable timeout feature for tool operations with automatic cancellation and fallback suggestions, including settings and UI updates, and adds tests for functionality.
global-settings.ts.TimeoutManagerandTimeoutFallbackHandlerfor managing and handling timeouts.tool_timeoutevent capture inTelemetryService.ts.toolExecutionTimeoutMsandtimeoutFallbackEnabledto settings inglobal-settings.tsandClineProvider.ts.AutoApproveSettings.tsxandSettingsView.tsxto include timeout settings.timeout-fallback.spec.ts,timeout-integration.spec.ts, and other test files.This description was created by
for 20a27f7. You can customize this summary. It will automatically update as commits are pushed.